<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <include file="public@head" />

</head>
<body>
<include file="public@nav" />

<div class="center cirWrapper clearfix">
    <div class="fl leftBox">

    </div>
    <div class="fr rightBox">
        <div class="liveTitle clearfix">
            <h4 class="fl">我关注的</h4>
            <span class="follow_num fr"></span>
            <!--  <b class="page_len">1/6</b>
            <b class="page_next fr"></b>
            <b class="page_prev fr"></b>-->
        </div>
        <ul class="livingWrapper" id="follow_wra">
            <!--<li>
                <a href="#">
                    <img class="fl" src="__TMPL__public/assets/img/user_img.png" alt=""/>
                    <h4 class="star_name fl">高圆圆</h4>
                    <span  class="fr live_but">直播中</span>
                </a>
            </li>-->
            <a href="{:url('Personal/focus')}" class="live_all_but">查看全部<span></span></a>
        </ul>
        <div class="down_load_code">
            <p>下载livestar手机app</p>
            <div>
                <img class="fl" src="__TMPL__public/assets/img/code2.jpg" alt="">
                <span class="fr" style="margin-bottom: 4px;">Ios</span>
                <span class="fr">Android</span>
            </div>
        </div>
    </div>
</div>
<include file="public@footer" />
<include file="public@scripts" />
<script>
    headerMove(2);

    $(function(){
        var get_mySubscribe = function(){
            var mySubscribe_param = {
                url:'Users/mySubscribe',
                data:{
                    page:1
                }
            };
            $.JsonRpc(mySubscribe_param,function(data){
                var mySubscribe_data = data.data.list;
                if(!mySubscribe_data.length){
                    var nullTxt = '<p class="null-tips-wrap">暂时没有关注的明星</p>';
                    $(".livingWrapper").html(nullTxt);
                    return false;
                }
                var tpl = "";
                var le = mySubscribe_data.length;

                if(le<8){
                    $(".follow_num").html('('+le+"人"+')');
                }else {
                    $(".follow_num").html("8人");
                }
                $.each(mySubscribe_data,function(i){
                    if(i>7){
                        return;
                    }
                    var live_class,live_txt;
                    (mySubscribe_data[i].live==1)?(live_class="",live_txt="直播中"):(live_class="star_page",live_txt="");
                    tpl +=
                            '<li>'+
                            '<a href="../Page/index.html?u_sid='+mySubscribe_data[i].s_udid+'">'+
                            '<img class="fl" src="'+mySubscribe_data[i].u_avatar+'" alt="">'+
                            '<h4 class="star_name fl">'+mySubscribe_data[i].s_name+'</h4>'+
                            '<span class="fr live_but '+live_class+'">'+live_txt+'</span>'+
                            '</a>'+
                            '</li>';
                });
                $(tpl).prependTo("#follow_wra");
            })
        };

//    get_mySubscribe();

        layui.use('flow', function(){
            var $ = layui.jquery; //不用额外加载jQuery，flow模块本身是有依赖jQuery的，直接用即可。
            var flow = layui.flow;
            flow.load({
                elem: '.leftBox' //指定列表容器
                ,isAuto:false
                ,done: function(page, next){ //到达临界点（默认滚动触发），触发下一页
                    var lis = [];
                    //以jQuery的Ajax请求为例，请求下一页数据（注意：page是从2开始返回）
                    var myCircle_param = {
                        url:'Circles/circleList',
                        data:{
                            page:page,
                            suid:0
                        }
                    };
                    $.JsonRpc(myCircle_param,function(data){
                        var star_list_data = data.data.list;
                        layui.each(star_list_data, function(index, item){
                            /*var listBoxClass = "";
                             if((index+1)%4==0){
                             listBoxClass = "tripleBox"
                             }*/
                            var likeClassName = "";
                            (star_list_data[index].booked==10)?likeClassName = "active":likeClassName = "";
                            var creat_time = star_list_data[index].c_createtime.slice(0,15);
                            var img_all = "";
                            if(star_list_data[index].c_images){
                                var img_arr = String(star_list_data[index].c_images).split(",");
                                for(var i=0;i<img_arr.length;i++){
                                    img_all += '<a href="../Circle/detail.html?cid='+star_list_data[index].cid+'"><img src="'+img_arr[i]+'" alt=""></a>';
                                }
                            }
                            var tpl =
                                    '<div class="sc_list_box" id="cid'+star_list_data[index].cid+'">'+
                                    '<div class="sc_title clearfix">'+
                                    '<a href="../Page/index.html?u_sid='+star_list_data[index].c_udid+'&u_name='+star_list_data[index].u_nickname+'"><img class="star_img fl" src="'+star_list_data[index].u_avatar+'" alt=""></a>'+
                                    '<div class="fl">'+
                                    '<h4 class="star_name">'+star_list_data[index].u_nickname+'</h4>'+
                                    '<p class="star_publish_time">'+creat_time+'</p>'+
                                    '</div>'+
                                    '</div>'+
                                    '<p class="star_publish_txt"><a href="../Circle/detail.html?cid='+star_list_data[index].cid+'">'+star_list_data[index].c_content+'</a></p>'+
                                    '<div class="imgWra clearfix">'+
                                    img_all+
                                    '</div>'+
                                    '<ul class="sc_row_line clearfix">'+
                                    '<li>'+
                                    '<span class="c_like">'+star_list_data[index].c_like+'</span>'+
                                    '<i class="ic_praise '+likeClassName+'" data-cid="'+star_list_data[index].cid+'"></i>'+
                                    '</li>'+
                                    '<li>'+
                                    '<span>'+star_list_data[index].c_comment+'</span>'+
                                    '<i class="ic_comment"></i>'+
                                    '</li>'+
                                    '<li>'+
                                    '<span>'+star_list_data[index].c_share+'</span>'+
                                    '<i class="ic_share"></i>'+
                                    '</li>'+
                                    '</ul>'+
                                    '</div>';
                            lis.push(tpl);
                        });
                        next(lis.join(''), page < Math.ceil(data.data.num/20));
                        //点赞帖子
                        $(".ic_praise").off("click").on("click",function(){
                            var ic_prize_now = $(this);
                            var cid = $(this).data("cid");
                            var praise_param = {
                                url:'Circles/likeCircle',
                                data:{
                                    cid: cid
                                }
                            };
                            $.JsonRpc(praise_param,function(data){
                                if(data.code==200){
                                    if(data.data.status==10){
                                        ic_prize_now.addClass('layui-anim layui-anim-scaleSpring active');
                                        ic_prize_now.siblings(".c_like").html(data.data.number);
                                    }else if(data.data.status==20){
                                        ic_prize_now.removeClass('layui-anim layui-anim-scaleSpring active');
                                        ic_prize_now.siblings(".c_like").html(data.data.number);
                                    }
                                }
                            })
                        });
                        $(".sg_list_wra").on("mouseover mouseout",".btn_cancel",function(event){
                            if(event.type == "mouseover"){
                                $(this).html("取消关注");
                            }else if(event.type == "mouseout"){
                                $(this).html("已关注");
                            }
                        });
                        get_mySubscribe();
                    });
                }
            });
        });
    });
</script>
</body>
</html>























